package com.guomw.report.service.repository;

import com.guomw.report.service.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.ResponseBody;

@ResponseBody
public interface UserRepository extends JpaRepository<User, Integer>, JpaSpecificationExecutor<User> {

    @Transactional
    @Modifying
    @Query("update  User u set u.userToken=?2 where u.userId=?1")
    Integer updateUserToken(int userId, String userToken);
}
